import java.util.Scanner;

public class demo1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i=0;i<n;i++){
            arr[i]=scanner.nextInt();
        }
        long [] temp = new long[n];
        temp[0] = arr[0];
        for (int i = 1; i < n; i++) {
            temp[i] = temp[i - 1] + arr[i];
        }
        long sum = 0;
        for (int i = 0; i < n - 1; i++) {
            sum += arr[i] * (temp[n - 1] - temp[i]);
        }
        System.out.println(sum);
    }
}
